import { configureStore } from "@reduxjs/toolkit"
import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux"

import homeReducer from "./modules/home"
import userReducer from "./modules/user"


const store = configureStore({
  reducer:{
    home:homeReducer,
    user:userReducer
  }
})

export type RootState = ReturnType<typeof store.getState>
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector

export type AppDispatch = typeof store.dispatch
export const useAppDiapatch: () => AppDispatch = useDispatch

export default store